#!/bin/sh
###############################################################################
#
# File:         w2
# RCS:          $Id: $
# Description:  Launch WWWeasel-II.
# Author:       Niels P. Mayer
# Created:      Fri Oct  6 00:38:44 1995
# Modified:     Sun Nov 23 21:40:23 1997 (Niels Mayer) npm@mayer.netcom.com
# Language:     Ksh
# Package:      N/A
# Status:       Experimental (Do Not Distribute)
#
# Copyright (C) 1994-1996 Enterprise Integration Technologies Corp. and Niels Mayer.
# WINTERP 1.15-1.99, Copyright (c) 1993, Niels P. Mayer.
# WINTERP 1.0-1.14, Copyright (c) 1989-1992 Hewlett-Packard Co. and Niels Mayer.
# 
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of Enterprise Integration Technologies,
# Hewlett-Packard Company, or Niels Mayer not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. Enterprise Integration Technologies, Hewlett-Packard
# Company, and Niels Mayer makes no representations about the suitability of
# this software for any purpose.  It is provided "as is" without express or
# implied warranty.
# 
# ENTERPRISE INTEGRATION TECHNOLOGIES, HEWLETT-PACKARD COMPANY AND NIELS MAYER
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ENTERPRISE
# INTEGRATION TECHNOLOGIES, HEWLETT-PACKARD COMPANY OR NIELS MAYER BE LIABLE
# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
###############################################################################

##
## Tell everybody where the files are located...
##
# WWWEASEL_BASE_DIR=/usr/local/lib/wwweasel/
WWWEASEL_BASE_DIR=/home/npm/src/winterp-xlisp21g/WWWeasel/
export WWWEASEL_BASE_DIR


##
## This is to prepend paths onto the environment so that the
## correct paths are in the wwweasel user environment for the
## helper programs
##
PATH=${WWWEASEL_BASE_DIR}bin-linux:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/andrew/bin:/usr/openwin/bin:${PATH}
export PATH


##
## Append the location of the resources file for the authoring environment.
## Users may override the default application defaults by placing a modified
## copy of ${WWWEASEL_BASE_DIR}app-defaults/WWWeasel in
## $HOME/.desktop-`hostname`/WWWeasel or $HOME/WWWeasel
##
XUSERFILESEARCHPATH=${XUSERFILESEARCHPATH}:${HOME}/%N:${WWWEASEL_BASE_DIR}app-defaults/%N
export XUSERFILESEARCHPATH


##
## Tell Winterp-Lisp code that we're running as a standalone application. THis
## changes WINTERP exit behavior s.t. quitting a toplevel shell via the window
## manager actually kills the winterp process.
##
WINTERP_STANDALONE_APP=TRUE
export WINTERP_STANDALONE_APP

WWWEASEL_BIN_DIR="${WWWEASEL_BASE_DIR}bin-linux/"
WWWEASEL_RUNTIME="${WWWEASEL_BIN_DIR}WWWeasel"
WWWEASEL_ARGS="							\
    -class WWWeasel-linux					\
    -lib_dir ${WWWEASEL_BASE_DIR}lisp/				\
    -no_stdin_serv -no_unix_serv -no_inet_serv -no_init_msgs"
WWWEASEL_DELIV_ARGS="						\
   -init_file ${WWWEASEL_BASE_DIR}wwweasel.lsp			\
   -enable_lisp_restore						\
   -lisp_restore_file ${WWWEASEL_BIN_DIR}wwweasel.wks"
WWWEASEL_DEVEL_ARGS="						\
    -init_file ${WWWEASEL_BASE_DIR}lisp/weezle.lsp"

##
## Run WWWeasel development system if user passes
## "-enable_init" or "-enable_unix"
##
if [ $# -gt 0 ]
then
   if [ $1 = -enable_init -o $1 = -enable_unix ]
   then
      echo Running WWWeasel development system ...
      exec ${WWWEASEL_RUNTIME} ${WWWEASEL_ARGS} ${WWWEASEL_DEVEL_ARGS} $*
   else
## Run the deliverable WWWeasel system
      exec ${WWWEASEL_RUNTIME} ${WWWEASEL_ARGS} ${WWWEASEL_DELIV_ARGS} $*
   fi
else
## With no args given, run the deliverable WWWeasel system
   exec ${WWWEASEL_RUNTIME} ${WWWEASEL_ARGS} ${WWWEASEL_DELIV_ARGS}
fi

#exec ${WWWEASEL_RUNTIME} \
# ${WWWEASEL_ARGS} \
# ${WWWEASEL_DEVEL_ARGS} \
# -load_path /home/npm/src/widgit/examples/:/home/npm/src/wwweasel/ \
# -enable_unix_server \
# -enable_stdin_server \
# -enable_init_msgs \
# $*
